<template>
  <div class="home" v-wechat-title="title">
    <company-App></company-App>
    <company-search></company-search>
    <company-banner></company-banner>
    <company-menu></company-menu>
    <company-entrust></company-entrust>
    <company-list></company-list>
    <company-senior></company-senior>
    <company-cooperative></company-cooperative>
    <common-nav :num="num"></common-nav>
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
import CommonNav from 'common/Nav'
import CompanyApp from './components/Companyapp'
import CompanySearch from './components/CompanySearch'
import CompanyBanner from './components/CompanyBanner'
import CompanyMenu from './components/CompanyMenu'
import CompanyEntrust from './components/CompanyEntrust'
import CompanyList from './components/CompanyList'
import CompanySenior from './components/CompanySenior'
import CompanyCooperative from './components/CompanyCooperative'

export default {
  name: 'Home',
  components: {
    CommonNav,
    CompanyApp,
    CompanySearch,
    CompanyBanner,
    CompanyMenu,
    CompanyEntrust,
    CompanyList,
    CompanySenior,
    CompanyCooperative
  },
  data () {
    return {
      num: 0,
      title: '搜城商铺网'
    }
  },
  beforeMount () {
    this.index()
  },
  methods: {
    ...mapMutations(['changeDcity']),
    ...mapMutations(['changephone']),
    ...mapMutations(['changeDcityId']),
    index () {
      if (sessionStorage.getItem('Dcity') === "" || sessionStorage.getItem('Dcity') === null) {
        this.changeDcity({ Dcity: '北京' })
        this.changephone({ phone: '400-600-8728' })
        this.changeDcityId({ Cid: 2 })
      }
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="stylus" scoped>
.home
  width 100%
  padding-bottom 1.2rem
</style>
